import {
  LoginInfo,
  GetRole,
  ruleinfo,
  Setpermission,
  User,
  menuinfo,
  formInfo,
  DeptDialogForm,
} from "@/types/type";
import http from "../untils/http";
const requestApi = {
  // 1.请求数据
  login: (data: LoginInfo) =>
    http({
      url: "/users/login",
      method: "POST",
      data,
      mock: false,
    }),

  // 2.请求菜单数据
  getMenuList: (data?: User) =>
    http({
      url: "/menu/list",
      method: "GET",
      data,
      mock: false,
    }),

  // 3.请求用户列表
  getUserList: (data: User) =>
    http({
      url: "/users/list",
      method: "GET",
      data,
      mock: false,
    }),

  // 4.系统角色请求
  getRoleList: (data?: GetRole) =>
    http({
      url: "/role/list",
      method: "GET",
      data,
      mock: false,
    }),

  // 5.系统部门请求
  getDeptList: (data?: User) =>
    http({
      url: "/dept/list",
      method: "GET",
      data,
      mock: false,
    }),
  // 6.系统删除用户
  delUser: (data: User) =>
    http({
      url: "/users/delete",
      method: "POST",
      data,
      mock: false,
    }),
  // 7.修改用户信息
  EditUser: (data: User) =>
    http({
      url: "/users/edit",
      method: "POST",
      data,
      mock: false,
    }),

  // Role页
  // 8.添加角色权限信息
  AddRole: (data?: GetRole) =>
    http({
      url: "/role/add",
      method: "POST",
      data,
      mock: false,
    }),
  // 9.编辑角色权限信息?
  EditRole: (data?: ruleinfo) =>
    http({
      url: "/role/edit",
      method: "POST",
      data,
      mock: false,
    }),
  // 10.删除角色权限信息
  DelRole: (data?: string) =>
    http({
      url: "/role/delete",
      method: "POST",
      data: { _id: data },
      mock: false,
    }),
  // 11.编辑权限
  PerRole: (data: Setpermission) =>
    http({
      url: "/role/permission",
      method: "POST",
      data,
      mock: false,
    }),
  // Menu页
  // 12. 菜单操作
  OperateMenu: (data?: formInfo) =>
    http({
      url: "/menu/operate",
      method: "POST",
      data,
      mock: false,
    }),
  // 13.部门操作
  OperateDept: (data?: DeptDialogForm) =>
    http({
      url: "/dept/operate",
      method: "POST",
      data,
      mock: false,
    }),
};

export default requestApi;
